import Axios from "axios";

export default {
  mode: 'universal',
  env: {
    BASE_URL: process.env.BASE_URL,
    NODE_ENV: process.env.NODE_ENV
  },
  /*
  ** Headers of the page
  */
  head: {
    // title: process.env.npm_package_name || '',
    title: '岸上教育',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },
  /*
  ** Customize the progress-bar color
  */
  loading: { color: '#fff' },
  // router: {
  //   extendRoutes (routes, resolve) {
  //     routes.push({
  //       name: 'errer',
  //       path: '*',
  //       component: resolve(__dirname, 'layouts/error.vue')
  //     })
  //   }
  // },
  /*
  ** Global CSS
  */
  css: [
    '@/assets/font/font.scss',
    '@/assets/css/main.scss',
    {
      src: 'swiper/css/swiper.css'
    },
    {
      src: 'assets/css/index.css'
    }
  ],
  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
    // 引入全局axios
    {
      src: '~/plugins/main',
      ssr: true
    },
    // 引入swiper
    {
      src: '~/plugins/swiper.js',
      ssr: false
    },
    {
      src: '~/plugins/vue-element-ui.js',
      ssr: true
    }
  ],
  /*
  ** Nuxt.js dev-modules
  */
  buildModules: [
  ],
  /*
  ** Nuxt.js modules
  */
  modules: [
    '@nuxtjs/axios',
    '@nuxtjs/style-resources'
  ],
  /*
  ** Build configuration
  */
  build: {
    /*
    ** You can extend webpack config here
    */
    vendor: ['axios', 'element-ui'],
    publicPath: '/_nuxt/',
    extend (config, ctx) {
    }
  },
  generate: {
    interval: 500,
    routes: function () {
      return Axios.post(process.env.BASE_URL + '/index/returnUrl').then((res) => {
        return res.data.data
      })
    }
  }
}
